<?php

namespace App\Http\Controllers;

use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\DB;

class HealthController extends Controller
{
    // 项目运行检测
    public function checkStatus(): JsonResponse
    {
        return response()->json([
            'status' => true,
        ]);
    }

    // 数据库连接检测
    public function checkDatabase(): JsonResponse
    {
        try {
            DB::connection()->getPdo();
            return response()->json([
                'status' => true,
            ]);
        } catch (\Exception $e) {
            return response()->json([
                'status' => false,
            ]);
        }
    }
} 